#ifndef CALCULATOR_H
#define CALCULATOR_H

#include "ui_calculator.h"

#include <QWidget>
#include <QFile>
#include <QMessageBox>
#include <QString>
#include <QStack>
#include <QStack>
#include <QMap>
#include <cmath>
#include <QDebug>
#include <QtMath>
#include <QRegularExpression>
#include <QRegularExpressionMatch>

QT_BEGIN_NAMESPACE
namespace Ui { class Calculator; }
QT_END_NAMESPACE

class Calculator : public QWidget
{
    Q_OBJECT

public:
    Calculator(QWidget *parent = nullptr);
    ~Calculator();

    void loadStyleSheetFile(const QString &styleSheetFile);

    void btnNumClicked(double x);

    void btnOperatorClicked(char op);

    void btnCClicked();
    void btnCEClicked();
    void btnBackClicked();
    void btnSquareClicked();
    void btnSqrtClicked();
    void btnSpotClicked();
    void btnFractionClicked();
    void btnPerClicked();
    void btnReverseClicked();
    bool btnEqualClicked();

private:
    void initConnections();
    void initMembers();
    bool isPureNumber(const QString& sen);

    // int getDecimalPlaces(const QString &text) const;

private slots:

private:
    Ui::Calculator *ui;

    size_t decimalCount;
    double num;
    double decimalPlaces;
    double result;
    char operation;
    QString sentence;
    bool isNewOperation;
    bool isFirstElement;
    bool hasDecimalPoint;
    bool EqualBtnClicked;

};
#endif // CALCULATOR_H
